FindControl
Point localPt ; a point in LOCAL coordinates WindowPtr theWindow ; window containing localPt returns control part code; 0=none, 10=inButton, etc.
(if any) has been clicked. It returns a handle to identify the control and a
control part code indicating which part of the control was selected.
localPt is a 4-byte Point structure, expressed in local ( window) coordinates. It is normally the local equivalent of the where field of theWindow identifies a window; the controlList of that window is searched for a
control which corresponds to localPt. This is normally a value
whichCtl is the address of a 4-byte ControlHandle data type. Upon return, it
will contain a handle of the control located at localPt or NIL if no
active control exists at localPt.
Returns: a short; the part code identifying which part of the control was selected. A return value of 0 indicates that localPt mouse press
occurred where no active control exists.
The following named constants identify part codes you might receive
for standard controls:
(0) None
inButton (10) Anywhere in a standard push button
inCheckBox (11) Anywhere in a check box or radio button
inUpButton (20) Up (or left) arrow in scroll bar
inDownButton (21) Down (or right) arrow in scroll bar
inPageUp (22) Above (or to the left of) thumb in scroll bar
inPageDown (23) Below (or to the right of) thumb in scroll bar
inThumb (129) Thumb of a scroll bar
Notes: FindControl is an important step in a normal event loop. It is called when a mouse-down event occurs in the content region of an active window
owned by the application. Most often, this call is followed by a call to
if ( theEvent.what == mouseDown) ...
if in myWindow and if inContent ...
if "instant" control (e.g., inPageUp), handle it
... and perform the appropriate action
coordinates!
If localPt is in an inactive or invisible control, or is not part of any
control at all, the return code is 0 and whichCtl is set to NIL. See